const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    id:'',
    sex:0
  },

  goPage(e){
    let type = e.currentTarget.dataset["type"]
    if(type=='tz'){
      wx.navigateTo({ url:'/pages/answer/answer?id='+this.data.id+'&sex='+this.data.sex });
    }else{
      wx.navigateTo({ url:'/pages/mbi/mbi?familyMemberId='+this.data.id });
    }
    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    if(options.id){
      this.setData({
        id:options.id
      })
    }
    if(options.sex){
      this.setData({
        sex:options.sex
      })
    }
    if(options.parentid){
      app.globalData.parentid=options.parentid
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  onShareAppMessage: function (e) {
    let userInfo=wx.getStorageSync('userInfo') || '';
    var parentid='';
    if(userInfo){
      parentid=userInfo.id
    }
    var path="pages/selectMember/selectMember?parentid="+parentid;

    let title = '';
    let imageUrl = '';
    let obj = {
      title,
      imageUrl,
      path,
      success: function (res) {},
      fail(err) {}
    }
    return obj
  },
  onShareTimeline: function(res){
    let userInfo=wx.getStorageSync('userInfo') || '';
    var parentid='';
    if(userInfo){
      parentid=userInfo.id
    }
    var path="pages/selectMember/selectMember?parentid="+parentid;

    let title = '';
    let imageUrl = '';
    let obj = {
      title,
      imageUrl,
      path,
      success: function (res) {},
      fail(err) {}
    }
    return obj
  },
})